<!doctype html public "-//w3c//dtd html 4.0 transitional//en"
     "http://www.w3.org/TR/REC-html40/strict.dtd">
     <%@ page import="java.sql.*"%>
     <%@ page import="javax.sql.*"%>
     <%@ page import="javax.naming.*"%>
     <%@ page session="false" %>
     <html>
     <head>
     <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
     <title>Test of MySQL connection pool</title>
     </head>
     <body>
     <%
     out.print("Start<br/>");
     try{
     Context ctx = new InitialContext();
     javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup("java:comp/env/jdbc/mysql");
     Connection conn = ds.getConnection();
     out.println("MySQL connection pool runs perfectly!");
     Statement stmt = conn.createStatement();
     ResultSet rs = stmt.executeQuery("describes users");
     if(rs.next()){
     ResultSetMetaData rsmd = rs.getMetaData();
     out.println(rsmd.getColumnTypeName(3));
     out.println(rsmd.getColumnLabel(2));
     out.println(rs.getString(3));
     }
     conn.close();
     }
     catch(Exception ex){
     out.print(ex.getMessage());
     ex.printStackTrace();
     }
     %>
     </body>
     </html>
